/*
 * author      : 吴中勤 
 * date        : 2018/8/17
 * description : SAP 订单
 */

package com.deepexi.adapter.sdk.sap.dto.order;

import com.deepexi.adapter.sdk.sap.dto.SapBaseRequest;
import com.google.gson.annotations.SerializedName;

import java.util.ArrayList;
import java.util.List;


public class SapOrderRequestBody extends SapBaseRequest {
    public static final String ACTION_CREATE_ORDER = "D";
    public static final String ACTION_VEHICLE_LOCK = "A";
    public static final String ACTION_VEHHICLE_UNLOCK = "U";
    public static final String ACTION_BILLING = "B";
    public static final String ACTION_UPADATE_ORDER = "C";
    public static final String ACTION_CANCEL_ORDER = "E";
    public static final String ACTION_STOCK_OUT = "O";
    public static final String ACTION_PURCHASE = "P";

    public static final String HAS_LOAN = "X";
    public static final String CHANGE_MARK = "X";

    /** 卡券使用类型 01是什么含义我也不知道 fuck */
    private static final String COUPON_USAGE_TYPE_01 = "01";

    // 门店
    @SerializedName("BUKRS")
    protected String shopCode;

    // SAP生成的订单号
    @SerializedName("VBELN")
    protected String sapOrderNo;

    // 订单类型, 判定规则, 如果订单行里面有车, 则=350X, 否则Q007
    // 大客户=Q005 整车=350X 精品单独销售=Q007
    @SerializedName("AUFART")
    protected String orderType;

    // 销售顾问编号 sale consult
    @SerializedName("PERNR")
    protected String scCode;

    // 售达方
    @SerializedName("KUNNR")
    protected String whoPlaceOrder;

    // 送达方
    @SerializedName("KUNWE")
    protected String whoReceiveItem;

    // 收票方
    @SerializedName("KUNRE")
    protected String whoGetReceipt;

    // 付款方
    @SerializedName("PARTNER")
    protected String whoPaid;

    // 内部车辆编号
    @SerializedName("VHCLE")
    protected String vechileCode;

    // 分销渠道 判定规则, 如果订单行里面有车, 则=10, 否则=20
    // 10=销售，整车/随车销售
    // 20=售后，精品单独销售
    @SerializedName("VTWEG")
    protected String saleChannel;

    // 产品组, 空值
    @SerializedName("SPART")
    private final String spart = "";

    // 现车, 空值
    @SerializedName("ZZSTOCK")
    private final String stockedVechile = "";

    // 置换, 空值
    @SerializedName("ZZEXCHA")
    private final String exchangeVechile = "";
    // 置换方式, 空值
    @SerializedName("ZZEXCHA_TYPE")
    private final String exchangeType = "";
    // 置换价格, 空值
    @SerializedName("ZZEXCHA_PRICE")
    private final String exchagePrice = "";

    // 选择是否分期, 是否
    @SerializedName("ZZLOAN")
    protected String hasLoan = "";

    // 首付金额
    @SerializedName("ZZFIRSTPAY")
    protected String firstPay = "";

    // 贷款金额
    @SerializedName("ZZLASTPAY")
    protected String loanAmount = "";

    // 本地上牌, 空值
    @SerializedName("ZZREGION")
    private final String localLiscence = "";

    // 指标方式, 空值
    @SerializedName("ZZZHIBIAO_TYPE")
    private final String liscenceRequireType = "";

    // 置换的车架号, 空值
    @SerializedName("ZZVIN")
    private final String exchangeVin = "";

    // 预计交车日期, 空值, 在商品出库接口中表示 开票日期
    @SerializedName("DATUM")
    protected String deliveryDate = "";

    // 订单抬头修改标识
    @SerializedName("CHANGE_H")
    protected String changeMark = "";

    // 卡券使用类型
    @SerializedName("ZYWLX")
    protected String couponUsageType = COUPON_USAGE_TYPE_01;
    // 执行动作
    //    D	订单创建
    //    A	分车
    //    U	取消分车
    //    R	追加预付款
    //    C	修改订单
    //    E	取消订单
    @SerializedName("ACTION")
    protected String action = "";

    // 备注
    @SerializedName("REMARK")
    protected String remark;

    // 下单账户
    @SerializedName("CUSTOMER")
    protected String memberId;

    // 操作用户
    @SerializedName("USERID")
    protected String operatorId;

    // moby订单号
    @SerializedName("ORDERID")
    protected String mobyOrderId;

    @SerializedName("Items")
    protected List<SapOrderLine> lineList;

    public SapOrderRequestBody addLineItem(SapOrderLine line) {
        if (null == lineList) lineList = new ArrayList<>();
        lineList.add(line);
        return this;
    }

    public void fieldChanged() {
        this.changeMark = CHANGE_MARK;
    }

    // === setter & getter ====


    public String getShopCode() {
        return shopCode;
    }

    public String getSapOrderNo() {
        return sapOrderNo;
    }

    public String getOrderType() {
        return orderType;
    }

    public String getScCode() {
        return scCode;
    }

    public String getWhoPlaceOrder() {
        return whoPlaceOrder;
    }

    public String getWhoReceiveItem() {
        return whoReceiveItem;
    }

    public String getWhoGetReceipt() {
        return whoGetReceipt;
    }

    public String getWhoPaid() {
        return whoPaid;
    }

    public String getVechileCode() {
        return vechileCode;
    }

    public String getSaleChannel() {
        return saleChannel;
    }

    public String getSpart() {
        return spart;
    }

    public String getStockedVechile() {
        return stockedVechile;
    }

    public String getExchangeVechile() {
        return exchangeVechile;
    }

    public String getExchangeType() {
        return exchangeType;
    }

    public String getExchagePrice() {
        return exchagePrice;
    }

    public String getHasLoan() {
        return hasLoan;
    }

    public String getFirstPay() {
        return firstPay;
    }

    public String getLoanAmount() {
        return loanAmount;
    }

    public String getLocalLiscence() {
        return localLiscence;
    }

    public String getLiscenceRequireType() {
        return liscenceRequireType;
    }

    public String getExchangeVin() {
        return exchangeVin;
    }

    public String getDeliveryDate() {
        return deliveryDate;
    }

    public String getChangeMark() {
        return changeMark;
    }

    public String getAction() {
        return action;
    }

    public String getRemark() {
        return remark;
    }

    public String getMemberId() {
        return memberId;
    }

    public String getOperatorId() {
        return operatorId;
    }

    public String getMobyOrderId() {
        return mobyOrderId;
    }

    public List<SapOrderLine> getLineList() {
        return lineList;
    }

//
//    public void setShopCode(String shopCode) {
//        this.shopCode = shopCode;
//    }
//
//    public void setSapOrderNo(String sapOrderNo) {
//        this.sapOrderNo = sapOrderNo;
//    }
//
//    public void setOrderType(String orderType) {
//        this.orderType = orderType;
//    }
//
//    public void setScCode(String scCode) {
//        this.scCode = scCode;
//    }
//
//    public void setWhoPlaceOrder(String whoPlaceOrder) {
//        this.whoPlaceOrder = whoPlaceOrder;
//    }
//
//    public void setWhoReceiveItem(String whoReceiveItem) {
//        this.whoReceiveItem = whoReceiveItem;
//    }
//
//    public void setWhoGetReceipt(String whoGetReceipt) {
//        this.whoGetReceipt = whoGetReceipt;
//    }
//
//    public void setWhoPaid(String whoPaid) {
//        this.whoPaid = whoPaid;
//    }
//
//    public void setVechileCode(String vechileCode) {
//        this.vechileCode = vechileCode;
//    }
//
//    public void setSaleChannel(String saleChannel) {
//        this.saleChannel = saleChannel;
//    }
//
//    public void setHasLoan(String hasLoan) {
//        this.hasLoan = hasLoan;
//    }
//
//    public void setFirstPay(String firstPay) {
//        this.firstPay = firstPay;
//    }
//
//    public void setLoanAmount(String loanAmount) {
//        this.loanAmount = loanAmount;
//    }
//
//    public void setChangeMark(String changeMark) {
//        this.changeMark = changeMark;
//    }
//
//    public void setAction(String action) {
//        this.action = action;
//    }
//
//    public void setRemark(String remark) {
//        this.remark = remark;
//    }
//
//    public void setProfitCenter(String profitCenter) {
//        this.profitCenter = profitCenter;
//    }
//
//    public void setMemberId(String memberId) {
//        this.memberId = memberId;
//    }
//
//    public void setOperatorId(String operatorId) {
//        this.operatorId = operatorId;
//    }
//
//    public void setMobyOrderId(String mobyOrderId) {
//        this.mobyOrderId = mobyOrderId;
//    }
//
//    public void setLineList(List<SapOrderLine> lineList) {
//        this.lineList = lineList;
//    }
}
